<template>
  <div>
    <el-row>
      <el-col :span="24">
        <div class="addccc">
          <el-button
            @click="newest(1)"
            type="primary"
            icon="el-icon-circle-plus-outline"
            >新增考核</el-button
          >
        </div>
      </el-col>
      <el-col :span="24">
        <div>
          <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="name" label="姓名" width="">
            </el-table-column>
            <el-table-column prop="date" label="职位" width="">
            </el-table-column>
            <el-table-column prop="address" label="考核人"> </el-table-column>
            <el-table-column prop="date1" label="考核日期"> </el-table-column>
            <el-table-column prop="address2" label="工作业绩">
            </el-table-column>
            <el-table-column prop="address3" label="工作效率">
            </el-table-column>

            <el-table-column prop="address4" label="评价得分">
            </el-table-column>

            <el-table-column prop="annuala" label="年终奖"> </el-table-column>
            <el-table-column prop="address5" label="备注"> </el-table-column>
            <el-table-column label="操作" width="250" align="center">
              <template #default="scope">
                <el-button
                  size="mini"
                  @click="handleEdit(scope.$index, scope.row)"
                  >编辑</el-button
                >

                <el-button
                  size="mini"
                  type="danger"
                  @click="handleDelete(scope.$index, scope.row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-col>
    </el-row>
    <el-dialog
      :title="single"
      v-model="plassets"
      width="45%"
      :close-on-click-modal="false"
    >
      <el-form ref="form" :inline="true" :model="form" label-width="80px">
        <el-form-item label="姓名" style="width: 350px">
          <el-input v-model="form.name" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="职位" style="width: 350px">
          <el-input v-model="form.position" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="考核人" style="width: 350px">
          <el-input v-model="form.people" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="考核日期" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.birthday"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
            >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工作业绩" style="width: 350px">
          <el-input v-model="form.results" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="工作效率" style="width: 350px">
          <el-input v-model="form.offices" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="评价得分" style="width: 350px">
          <el-rate v-model="form.score" allow-half />
        </el-form-item>
        <el-form-item label="年终奖" style="width: 350px">
          <el-input v-model="form.annuala" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="备注" style="width: 350px">
          <el-input
            type="textarea"
            :rows="2"
            style="width: 250px"
            placeholder="请输入内容"
            v-model="form.newnotes"
          >
          </el-input>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="plassets = false">取 消</el-button>
          <el-button type="primary" v-if="under == 1" @click="determine()"
            >确 定</el-button
          >
          <el-button @click="hardware()" v-else type="primary"
            >编辑 确 定</el-button
          >
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      plassets: false,
      single: "",
      under: 1,
      form: {
        name: "",
        position: "",
        people: "",
        birthday: "",
        results: "",
        offices: "",
        score: null,
        newnotes: "",
        annuala: "",
      },
      tableData: [
        {
          date: "销售",
          name: "张三",
          date1: "2021/1/1",
          address: "销售部",
          address1: "职员",
          address2: "优秀",
          address3: "优秀",
          address4: "4.5",
          address5: "...",
          annuala: "",
        },
      ],
    };
  },
  methods: {
    newest() {
      this.plassets = true;
      this.single = "新增业绩考核";
    },
    determine() {
      console.log(this.form.score);
    },
  },
};
</script>

<style scoped>
.addccc {
  margin-bottom: 20px;
}
</style>